//计算1+1/2 - 1/3 + 1/4 - 1/5 ...= ?  n通过键盘输入

#include <stdio.h>
int main(){
	int n = 0;
	int i = 0;
	float sum = 1;
	printf("输入一个数字：");
	scanf("%d",&n);

	for(int i = 2 ; i <= n ; i++){
		if(i % 2 == 0 ){
		sum = sum + 1.0 / i ;
		} else {
		sum = sum - 1.0 / i ;
		} 
	}
	printf("%.2f\n",sum);

	return 0;
}
